import React, { PureComponent } from 'react';
import { connect } from 'dva';
import { IDemoPageState } from './model';
import './style.scss';
import { hot } from 'react-hot-loader/root';

interface Props {
  store: IDemoPageState;
  dispatch: DvaDispatch;
}

class Index extends PureComponent<Props> {
  async componentDidMount() {
    console.log(this.props.store);
    const res = await this.props.dispatch({
      type: 'index/demoGetList',
      payload: {},
    });
    console.log(res);
    debugger;
    console.log(this.props.store);
  }

  render() {
    return (
      <div>
        <div className="box">bod</div>
        <input placeholder="请输入内容" />
      </div>
    );
  }
}

export default connect((model: any) => {
  return { store: model.index };
})(hot(Index));
